package model.displayer;

import controller.MainController;
import javafx.scene.layout.Pane;
import model.Shape;

public class ShapeDisplayerJFxFactory
{
    private static ShapeDisplayerJFxFactory instance = null;

    private ShapeDisplayerJFxFactory(){}

    public static ShapeDisplayerJFxFactory getInstance()
    {
        if(instance == null)
        {
            synchronized(ShapeDisplayerJFxFactory.class)
            {
                if(instance == null)
                    instance = new ShapeDisplayerJFxFactory();
            }
        }
        return instance;
    }

    public ShapeDisplayer getShapeDisplayer(Shape type,Pane canvas, MainController controller)
    {
        switch (type)
        {
            case Line:
                return new LineDisplayer(canvas,controller);
            case Triangle:
                return new TriangleDisplayer(canvas,controller);
            case Rectangle:
                return new RectangleDisplayer(canvas,controller);
            case Circle:
                return new CircleDisplayer(canvas,controller);
            case Ellipse:
                return new EllipseDisplayer(canvas,controller);
            case Text:
                return new TextDisplayer(canvas,controller);
            default:
                return null;
        }
    }
}
